<template>
  <div>
    <vxe-modal
      resize
      show-footer
      show-confirm-button
      show-cancel-button
      show-maximize
      mask-closable
      esc-closable
      v-model="showPopup"
      v-bind="$attrs"
      height="400"
      width="800"
      @show="showSubEvent"
      @confirm="$emit('confirm', form)"
    >
      <el-form ref="form" :model="form" label-width="100px">
        <el-form-item label="工艺路线卡号">
          <el-input v-model="form.nbid" placeholder="内部批次号"></el-input>
        </el-form-item>
        <el-form-item label="工艺路线卡">
          <scan v-model="form.img1"></scan>
        </el-form-item>
        <el-form-item label="首件卡">
          <scan v-model="form.img2"></scan>
        </el-form-item>
        <el-form-item label="尾件卡">
          <scan v-model="form.img3"></scan>
        </el-form-item>
      </el-form>
    </vxe-modal>
  </div>
</template>
<script>
import scan from "./scan.vue";
export default {
  components: { scan },
  props: {
    value: {
      type: [Boolean],
      default: false,
    },
    formData: {
      type: [Object],
      default: () => {
        return {};
      },
    },
  },
  data() {
    return {
      form: {},
    };
  },
  created() {},
  mounted() {},
  computed: {
    showPopup: {
      get() {
        return this.value;
      },
      set(value) {
        this.$emit("input", value);
      },
    },
  },
  watch: {},
  methods: {
    showSubEvent() {
      console.log("show");
      this.form = this.formData;
    },
    confirmSubEvent() {
      let rs = api.add(this.form);
      const $grid = this.$refs.gridRef;
      if ($grid) {
        $grid.commitProxy("reload");
      }
    },
  },
};
</script>
<style scoped lang="scss"></style>
